|
|
|
|
|
|
|
'
On Error GoTo SQLFileCloseErr
'
If intGlobalErr = False Then
If intSQLFileHandle <> 0 Then
Close (intSQLFileHandle)
End If
intSQLFlag = False
End If
GoTo SQLFileCloseExit
'
SQLFileCloseErr:
ErrMsg Err, Error$, intLine, strLine, "SQLFileClose"
InitApp
'
SQLFileCloseExit:
'
End Sub |
|
|
|
|
|
|
|
|
Now you get to the heart of the programSQLFileProcess. This routine reads each line of the script file and performs whatever processing is necessary to build and execute the SQL statements in the script. You also add a few lines that show the user the script lines as they are processed. Also, remember that the script file has regular SQL statements, special database CONNECT, VERSION, QUIET, OPEN, CREATE, and CLOSE words, and comments. This processing routine has to handle each of these differently. Of course, you need an error handler, too. |
|
|
|
|
|
|
|
|
Create a Public Sub procedure called SQLFileProcess and enter the code in Listing A.14. Don't be discouraged by the length of this piece of codeit won't take you long to enter it into the project. |
|
|
|
|
|
|
|
|
Listing A.14. Coding the SQLFileProcess routine. |
|
|
|
|
|
|
|
|
Sub SQLFileProcess()
'
' main loop for processing ASCII file lines
'
On Error GoTo SQLFileProcessErr
'
Dim cToken As String
'
If intSQLFlag = False Then
GoTo SQLFileProcessExit
End If
'
strSQLLine = ""
While Not EOF(intSQLFileHandle) |
|
|
|
|
|